@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  
  color: #2f2f2f;
  background-color: #f0f2f5;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  font-weight: 500;
  color: #646cff;
  text-decoration: inherit;
}
a:hover {
  color: #535bf2;
}

body {
  margin: 0;
  display: flex;
  place-items: center;
  min-width: 320px;
  min-height: 100vh;
}

h1 {
  font-size: 3.2em;
  line-height: 1.1;
}

button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  background-color: #1a1a1a;
  cursor: pointer;
  transition: border-color 0.25s;
}
button:hover {
  border-color: #646cff;
}
button:focus,
button:focus-visible {
  outline: 4px auto -webkit-focus-ring-color;
}

.code-block {
  position: relative;
  margin: 1em 0;
}

.code-header {
  background: #1e1e1e;
  padding: 0.5em 1em;
  border-bottom: 1px solid #333;
  color: #fff;
  font-family: monospace;
}

.code-lang {
  font-size: 0.9em;
  color: #888;
}

.code-block pre {
  margin: 0;
  padding: 1em;
}

.code-block-wrapper {
  counter-reset: line;
}

.code-block-wrapper .line {
  display: table-row;
}

.code-block-wrapper .line-number {
  display: table-cell;
  padding-right: 1em;
  text-align: right;
  color: #888;
  user-select: none;
}

.code-block-wrapper .line-number::before {
  content: counter(line);
  counter-increment: line;
}

/* 代码高亮主题自定义 */
.hljs {
  background: transparent;
  color: #d4d4d4;
}

.hljs-keyword {
  color: #569cd6;
}

.hljs-string {
  color: #ce9178;
}

.hljs-comment {
  color: #6a9955;
}

.hljs-function {
  color: #dcdcaa;
}

.hljs-number {
  color: #b5cea8;
}

.hljs-class {
  color: #4ec9b0;
}

.hljs-variable {
  color: #9cdcfe;
}

/* 微信公众号样式 */
.wechat-preview {
  font-size: 15px;
  word-spacing: 0.8px;
  letter-spacing: 0.1px;
}

.wechat-preview pre {
  position: relative;
  border-radius: 5px;
}

.wechat-preview .code-block-wrapper {
  position: relative;
  padding-left: 3.5em;
  background: #282c34;
  border-radius: 5px;
}

.wechat-preview .line {
  display: block;
  padding-right: 1em;
  color: #abb2bf;
}

.wechat-preview .line:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.wechat-preview .line-number {
  position: absolute;
  left: 0;
  color: #636d83;
  text-align: right;
  width: 3em;
  padding-right: 1em;
  user-select: none;
}

.wechat-preview img {
  margin: 0 auto;
  display: block;
  max-width: 100%;
  border-radius: 4px;
}

.wechat-preview p {
  margin: 1.5em 0;
}

.wechat-preview a {
  color: #576b95;
  border-bottom: 1px solid #d1e9ff;
}

.wechat-preview blockquote {
  padding: 15px;
  margin: 10px 0;
  border-left: 4px solid #258fb8;
  background: #f5f5f5;
  color: #666;
}

.wechat-preview table {
  margin: 15px 0;
  border-collapse: collapse;
  width: 100%;
}

.wechat-preview th,
.wechat-preview td {
  border: 1px solid #dfe2e5;
  padding: 10px;
}

.wechat-preview th {
  background-color: #f6f8fa;
  font-weight: bold;
}

@media (prefers-color-scheme: light) {
  :root {
    color: #2f2f2f;
    background-color: #f0f2f5;
  }
  a:hover {
    color: #747bff;
  }
  button {
    background-color: #f9f9f9;
  }
}
